package net.simflow.swf.analyzer.graph.opt;

import java.awt.BasicStroke;
import java.awt.Stroke;

import net.simflow.swf.analyzer.network.data.Link;

import org.apache.commons.collections15.Transformer;

public class EdgeToStrokeTransformer implements Transformer<Link, Stroke> {

	public static EdgeToStrokeTransformer makeInstance() {
		return new EdgeToStrokeTransformer();
	}

	private EdgeToStrokeTransformer() {

	}

	@Override
	public Stroke transform(Link link) {
		if (link.isControl()) {
			float dash[] = { 10.0f };
			return new BasicStroke(1.0f, BasicStroke.CAP_BUTT,
					BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
		} else {
			return new BasicStroke(1.0f);
		}
	}
}
